#pragma once


// CEXScrollBarThumb
typedef enum enumSTATUS
{
	SKIN_NORMAL,
	SKIN_FOCUS,
	SKIN_SELECT,
	SKIN_DISABLE
} SKIN_STATUS;

class AFX_EXT_CLASS CEXScrollBarThumb : public CWnd
{
	DECLARE_DYNAMIC(CEXScrollBarThumb)

public:
	CEXScrollBarThumb();
	virtual ~CEXScrollBarThumb();

	BOOL Create(const RECT& rect, CWnd* pParentWnd, UINT nID, BOOL bHorizontal);
	BOOL SetThumbBitmap(UINT nThumbID, UINT nBkgndID, UINT nIconID, int nPics,
		                  int nLeftWidth = 0, int nRightWidth = 0, 
                      int nTopHeight = 0, int nBottomHeight = 0);

protected:
	BOOL InitBgBitmap( CBitmap & bmpSrc, CBitmap & bmpDest, int nIndex, 
                    int nCount, BOOL bReSize = TRUE);

	enum STATUS
	{
		normal,
		focus,
		select,
		disable
	};

	BOOL m_bHorizonal;
	CPoint m_ptPrev;
	int m_nPrevPos;

	COLORREF m_crTransparent;

	UINT m_nThumbBitmapID;
	int m_nThumbPics;
	BOOL m_bSetThumbBitmap;
	CBitmap m_bmpThumb;
	int m_nLeftWidth;
	int m_nRightWidth;
	int m_nTopHeight;
	int m_nBottomHeight;

	UINT m_nBkgndBitmapID;
	UINT m_nIconBitmapID;

	SKIN_STATUS m_Status;

	UINT m_uLeaveTimerID;

	const int LEAVER_TIMER;
	const int LEAVER_ELAPSE;

protected:
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnPaint();
	afx_msg LRESULT OnNcHitTest(CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnTimer(UINT_PTR nIDEvent);
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
};


